package functionalTest;

import static org.junit.Assert.assertEquals;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import domain.Person;


public class PersonUnitTest {
	
	Person person = null;
	
	@Before
	public void setUp() throws Exception {
		person = new Person();
		person.setFullName("Anucha");
		person.setUserName("driver1");
		person.setPassword("driver1");
	}

	@After
	public void tearDown() throws Exception {
		person = null;
	}

	@Test
	public void testEncodePassword() {
		try {
			person.encodePassword();
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		assertEquals(person.getPassword(), "b85aef08608180db9d4ddad38ae40545");
	}
}
